package com.cn.zengzeng.spbzengzeng.accept;

import lombok.extern.slf4j.Slf4j;
import org.springframework.data.redis.connection.Message;
import org.springframework.data.redis.connection.MessageListener;
import org.springframework.data.redis.listener.adapter.MessageListenerAdapter;
import org.springframework.stereotype.Component;

/**
 * 订阅消息处理类
 * @Author: ZhangZengZeng
 * @Date: 2023/3/9 16:42
 */
@Component
@Slf4j
public class RedisListener extends MessageListenerAdapter implements MessageListener {

    @Override
    public void onMessage(Message message,byte[] bytes) {
        byte[] channel = message.getChannel();
        log.info("RedisListener监听渠道:{},信息:{}",new String(channel,0,channel.length) ,message.toString());
    }
}

